package com.xiaowen.service;

import com.xiaowen.dao.TravelMapper;
import com.xiaowen.entity.Travel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by 15c on 2017/11/18.
 */
@Service("Travel")
public class TravelServiceImpl  implements TravelService{
    @Autowired
    TravelMapper travelMapper;
    @Override
    public int addTravels(Travel travel) {
        return travelMapper.insertSelective(travel);
    }

    @Override
    public int deleteTravels(Integer travelId) {
        return travelMapper.deleteByPrimaryKey(travelId);
    }

    @Override
    public Travel showTravels(Integer travelId) {
        return travelMapper.selectTravelInfo(travelId);
    }

    @Override
    public List<Travel> showListTravels(Integer userId) {
        return travelMapper.selectTravelList(userId);
    }
    @Override
    public int updateLikeNum(Integer travleId) {
        return travelMapper.updateTravelLikeNum(travleId);
    }

    @Override
    public int updateLikeNumLess(Integer travleId) {
        return travelMapper.updateLikeNum(travleId);
    }

    @Override
    public int addPageView(Integer travleId) {
        return travelMapper.updatePageView(travleId);
    }

    @Override
    public List<Travel> showNewStrategy() {
        return travelMapper.selectNewStrategy();
    }

    @Override
    public List<Travel> showNewTravel() {
        return travelMapper.selectNewTavel();
    }

    @Override
    public List<Travel> showManyLikeStrategy() {
        return travelMapper.selectManyLikeStrategy();
    }

    @Override
    public List<Travel> showManyLikeTravel() {
        return travelMapper.selectManyLikeTavel();
    }


}
